package local.app.servers;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import local.app.authentiction.AuthenticationROOT;

public class CryptoServer extends Server implements AuthenticationROOT {
    private final String userName = AuthenticationROOT.userName;
    private final String password = AuthenticationROOT.userName;
    public CryptoServer(String nameServer, String ipAddress) throws JSchException {
        super(nameServer, ipAddress);
        session = this.setConfigAndReturnSession();
    }


    @Override
    public Session setConfigAndReturnSession() throws JSchException {
        Session session = new JSch().getSession(userName, getIpAddress(), getPort());
        session.setPassword(password);
        session.setConfig("StrictHostKeyChecking", "no");
        session.setConfig("cipher.s2c", "aes128-cbc");
        session.setConfig("KexAlgorithms", "+diffie-hellman-group1-sha1");
        return session;
    }

}
